Import('env')

if env.Dictionary()['PROGSUFFIX'] == '.exe':
    # Windows
    env.Append(LIBPATH=[
		'/boost_1_42_0/stage/lib',
		'../../archive/protobuf-2.3.0/src',
		'/msys/1.0/local/lib',
		'/Program Files/PostgreSQL/8.3/lib'])
    env.Append(CPPPATH=[
		'/Program Files/PostgreSQL/8.3/include',
		'/boost_1_42_0',
		'../proto', 
		'..',
		'../client', 
		'/msys/1.0/local/include'])
    env.Append(CPPDEFINES=['_WIN32_WINDOWS=0x0501'])
    env.Append(LIBS=[
        'liblibboost_system-mgw43-mt', 
        'ws2_32',
        'libprotobuf',
        'libpq'
		])
else:
    # POSIX
    includes = [
        '/usr/include/postgresql', '../client', '../proto', '..', '.', 
        '../../boost_1_42_0']
    env.Append(LIBPATH=[
        '/usr/lib/postgresql/8.4/lib', 
        '../../boost_1_42_0/stage/lib'])

    env.Append(CPPPATH=includes)
    env.Append(LIBS=['pq', 'protobuf', 'boost_system', 'boost_program_options'])

commonsources = ['../proto/database.pb.cc']
serversources = ['bufdb_server.cpp','bufDBServer.cpp','../client/bufferDB.cpp', '../setup/connect.cpp'] + commonsources
clientsources = ['fake_client.cpp'] + commonsources

prog1=env.Program(source=serversources)
Default(prog1)
prog2=env.Program(source=clientsources)
Default(prog2)

